blob: cd3af7440b0086616df81be82fe87b7ab0aee970 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
import styles from "../styles/info.module.css";
import Image from "next/image";
export default async function DramaInfo({ params }) {
const id = decodeURIComponent(params.id);
const info = await getDramaInfo(id);
return (
<div className={styles.Main}>
{info && (
<div className={styles.DramaInfoContainer}>
<div className={styles.TitleContainer}>
<p>{info.title}</p>
<Image
src={info.image}
width={160}
height={240}
alt="Drama Poster"
priority
/>
</div>
<div className={styles.DramaDescription}>
<h2>Description</h2>
<p>{info.description}</p>
</div>
{/* Genres */}
<div className={styles.DramaGenre}>
<span className={styles.genreMain}>Genres: </span>
{info.genres &&
info.genres.map((item, index) => (
<span key={index} className={styles.genreEntry}>
{item}
</span>
))}
</div>
{/* Other names */}
<div className={styles.DramaGenre}>
<span className={styles.genreMain}>AKA: </span>
{info.otherNames &&
info.otherNames.map((item, index) => (
<span key={index} className={styles.genreEntry}>
{item}
</span>
))}
</div>
</div>
)}
</div>
);
}
async function getDramaInfo(id) {
const res = await fetch(
`https://consumet-api-di2e.onrender.com/movies/dramacool/info?id=${id}`
);
const data = await res.json();
return data;
}
|